/*
 * Copyright (c) 2020.9，华乘电气科技有限公司
 * All rights reserved.
 *
 * 文件名称：infraredspectrumdefine.h
 * 
 * 初始版本：1.0
 * 作者：洪澄
 * 创建日期：2020/09/03
 * 摘要：红外图谱数据定义
 * 当前版本：1.0
 */

#pragma once

#include <QString>
#include <vector>
#include "dataspecification_def.h"

namespace DataSpecificationGW
{
    struct InfraredExtInformation
    {
        TemperatureUnit eTemperatureUnit; // 温度单位
        qint32 iTempLatticeWidth; // 温度点阵宽度w
        qint32 iTempLatticeHeight; // 温度点阵高度h
        qint32 iVisibleLightLenL1; // 可见光照片数据长度L1
        qint32 iInfraredDataLenL2; // 红外照片数据长度L2
        float fEmissivity; // 辐射率[0~1.00]
        float fMeasureDistance; // 测试距离
        float fAtomTemperature; // 大气温度（单位：摄氏度或华氏度）
        qint8 cRelativeHumidity; // 相对湿度[0~100]
        float fReflectedTemperature; // 反射温度（单位：摄氏度或华氏度）
        float fTemperatureWidthUpper; // 温宽上限（单位：摄氏度或华氏度）
        float fTemperatureWidthLower; // 温宽下限（单位：摄氏度或华氏度）

        InfraredExtInformation()
        {
            eTemperatureUnit = TEMPERATURE_UNIT_DEFAULT;
            iTempLatticeWidth = 0;
            iTempLatticeHeight = 0;
            iVisibleLightLenL1 = 0;
            iInfraredDataLenL2 = 0;
            fEmissivity = 0;
            fMeasureDistance = 0;
            fAtomTemperature = 0;
            cRelativeHumidity = 0;
            fReflectedTemperature = 0;
            fTemperatureWidthUpper = 0;
            fTemperatureWidthLower = 0;
        }

        InfraredExtInformation& operator=(const InfraredExtInformation& stInfraredExtInformation)
        {
            this->eTemperatureUnit = stInfraredExtInformation.eTemperatureUnit;
            this->iTempLatticeWidth = stInfraredExtInformation.iTempLatticeWidth;
            this->iTempLatticeHeight = stInfraredExtInformation.iTempLatticeHeight;
            this->iVisibleLightLenL1 = stInfraredExtInformation.iVisibleLightLenL1;
            this->iInfraredDataLenL2 = stInfraredExtInformation.iInfraredDataLenL2;
            this->fEmissivity = stInfraredExtInformation.fEmissivity;
            this->fMeasureDistance = stInfraredExtInformation.fMeasureDistance;
            this->fAtomTemperature = stInfraredExtInformation.fAtomTemperature;
            this->cRelativeHumidity = stInfraredExtInformation.cRelativeHumidity;
            this->fReflectedTemperature = stInfraredExtInformation.fReflectedTemperature;
            this->fTemperatureWidthUpper = stInfraredExtInformation.fTemperatureWidthUpper;
            this->fTemperatureWidthLower = stInfraredExtInformation.fTemperatureWidthLower;
            return *this;
        }

        bool operator==(const InfraredExtInformation& stInfraredExtInformation) const
        {
            if (!(this->eTemperatureUnit == stInfraredExtInformation.eTemperatureUnit)) return false;
            if (!(this->iTempLatticeWidth == stInfraredExtInformation.iTempLatticeWidth)) return false;
            if (!(this->iTempLatticeHeight == stInfraredExtInformation.iTempLatticeHeight)) return false;
            if (!(this->iVisibleLightLenL1 == stInfraredExtInformation.iVisibleLightLenL1)) return false;
            if (!(this->iInfraredDataLenL2 == stInfraredExtInformation.iInfraredDataLenL2)) return false;
            if (!qFuzzyCompare(this->fEmissivity, stInfraredExtInformation.fEmissivity)) return false;
            if (!qFuzzyCompare(this->fMeasureDistance, stInfraredExtInformation.fMeasureDistance)) return false;
            if (!qFuzzyCompare(this->fAtomTemperature, stInfraredExtInformation.fAtomTemperature)) return false;
            if (!(this->cRelativeHumidity == stInfraredExtInformation.cRelativeHumidity)) return false;
            if (!qFuzzyCompare(this->fReflectedTemperature, stInfraredExtInformation.fReflectedTemperature)) return false;
            if (!qFuzzyCompare(this->fTemperatureWidthUpper, stInfraredExtInformation.fTemperatureWidthUpper)) return false;
            if (!qFuzzyCompare(this->fTemperatureWidthLower, stInfraredExtInformation.fTemperatureWidthLower)) return false;
            return true;
        }
    };

    struct InfraredData
    {
        QByteArray qbaInfraredTemperatureData; // 红外温度数据
        QByteArray qbaVisibleLightPhotoData; // 可见光照片数据
        QByteArray qbaInfraredPhotoData; // 红外照片数据

        InfraredData()
        {
        }

        InfraredData& operator=(const InfraredData& stInfraredData)
        {
            this->qbaInfraredTemperatureData = stInfraredData.qbaInfraredTemperatureData;
            this->qbaVisibleLightPhotoData = stInfraredData.qbaVisibleLightPhotoData;
            this->qbaInfraredPhotoData = stInfraredData.qbaInfraredPhotoData;
            return *this;
        }

        bool operator==(const InfraredData& stInfraredData) const
        {
            if (!(this->qbaInfraredTemperatureData == stInfraredData.qbaInfraredTemperatureData)) return false;
            if (!(this->qbaVisibleLightPhotoData == stInfraredData.qbaVisibleLightPhotoData)) return false;
            if (!(this->qbaInfraredPhotoData == stInfraredData.qbaInfraredPhotoData)) return false;
            return true;
        }
    };
}
